package org.bdddemo.impl;

import junit.framework.Assert;

import org.bdddemo.impl.VehiculeBuilderImpl;
import org.bdddemo.impl.VehiculeRepositoryImpl;
import org.bdddemo.model.Vehicule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:my-datasource.xml")
public class SaisieVehicule {

	//@Autowired
	//private static VehiculeRepositoryImpl vrepository;
	
/**
 * 
 */@Test
	public void main() {

		// Given

		VehiculeBuilderImpl vbuilder = new VehiculeBuilderImpl();
		Vehicule v = vbuilder.toVehicule();

		// When*

		VehiculeRepositoryImpl vrepository = new VehiculeRepositoryImpl();

		Vehicule vres = vrepository.createVehicule(v);

		// then
		if (vres!=null)
		Assert.assertEquals(vres, v);
		else System.out.println("test echoué");

	}
	

	

}
